#include "Solution.h"
#include <iostream>

using namespace std;

int main()
{
	int n;
	Solution s;
	while(true)
	{
		cin>>n;
		if(n==0)
			break;
		int* A = new int[n];
		for(int i=0;i<n;i++)
			cin>>A[i];

		int m = s.removeDuplicates(A,n);
		for(int i=0;i<m;i++)
			cout<<A[i]<<" ";
		cout<<endl;
	}

	
}